package first;

public class MobileShop {
    int amount;

    public MobileShop(int amount) {
        this.amount = amount;
    }

    public void getAmount() {
        System.out.println("手机专卖店目前有" + amount + "部手机");
    }

    class InnerPurchaseMoney {
        private int value;

        public InnerPurchaseMoney(int value) {
            this.value = value;
        }

        public int buyPhoneNumber() {
            return value / 3333;
        }

        public int getValue() {
            return value;
        }
    }

    public void buyPhone(InnerPurchaseMoney money) {
        int num = money.buyPhoneNumber();
        if (amount >= num) {
            amount -= num;
            System.out.println("用价值" + money.getValue() + "的内部购物券买了" + num + "部手机");
        } else {
            System.out.println("手机数量不足，无法购买");
        }
    }
}
